// TOWN SCRIPT
//    Town 9: Thessalonica Mine
//      - connected to t10 Mine Tunnels
//      - three entrances
//        - south, entered via town 14
//      

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

// flags:
// 9, 0 = Chasm message (s)
// 9, 1 = Chasm message (n)
// 9, 2 = Entrance message
// 9, 3 = Inside building message
// 9, 4 = Passage message
// 9, 5 = Wall message (can get through)
// 9, 6 = Wall message (can't get through)
// 9, 7 = Wall message (not trying to get through)

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	turn_off_training(TRUE);
	set_crime_tolerance(1);
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if ((get_flag(52, 0) == FALSE) && (get_flag(9, 2) == FALSE)) {
		run_scenario_script(10);
	}
break;

beginstate 10;
	block_entry(TRUE);
	change_outdoor_location(0, 1, 33, 40);
	move_to_new_town(14, 16, 26);
break;

beginstate 11;
	block_entry(TRUE);
	move_to_new_town(10, 58, 56);
break;

beginstate 12;
	if (get_flag(9, 0) == FALSE) {
		set_flag(9, 0, TRUE);
		message_dialog("There is a chasm here that doesn't appear to have a way across.",
			 "It appears that there used to be a bridge judging from the debris scattered about.");
	}
break;

beginstate 13;
	if (get_flag(9, 1) == FALSE) {
		set_flag(9, 1, TRUE);
		message_dialog("There is a chasm here that doesn't appear to have a way across.",
			 "It appears that there used to be a bridge judging from the debris scattered about.");
	}
break;

beginstate 14;
	if (get_flag(51, 4) == FALSE) {
		reset_dialog();
		add_dialog_str(0, "There is a small painting on the wall.", 0);
		add_dialog_str(1, "It doesn't look like it is attached very well.", 0);
		add_dialog_choice(0, "Search");
		add_dialog_choice(1, "Leave it alone");
		choice = run_dialog(FALSE);
		if (choice == 1) {
			set_flag(51, 4, TRUE);
			message_dialog("Behind the painting, in a small indention, there is a small wood-like piece.",
				"It's a piece of the staff which you pick up.");
			change_spec_item(3, 1);
		}
	}
	else {
		message_dialog("You search behind the painting, but find nothing more.", "It is a nice painting though.");
	}
break;

beginstate 15;
	if (get_flag(9, 3) == FALSE) {
		set_flag(9, 3, TRUE);
		reset_dialog();
		add_dialog_str(0, "The rough building in the back of the hidden tunnel contains a couple of rotting corpses.", 0);
		add_dialog_str(1, "It looks as if the two that were hiding back here starved to death.", 0);
		add_dialog_str(2, "The cool, dry air has kept them in a remarkable shape, almost mummified.", 0);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(TRUE);
	}
break;

beginstate 16;
	if (get_flag(9, 4) == FALSE) {
		set_flag(9, 4, TRUE);
		message_dialog("The passage doesn't look like anyone has trod its surface for a long time.",
			"Dust and cobwebs fill the tunnel ahead.");
	}
break;

beginstate 17;
	run_scenario_script(11);
break;

beginstate 18;
	if (get_flag(51, 3) > 0) {
		block_entry(FALSE);
		if (get_flag(9, 5) == FALSE) {
			set_flag(9, 5, TRUE);
			reset_dialog();
			add_dialog_str(0, "The wall here feels funny and you can stick your hand through it.", 0);
			add_dialog_str(1, "This must be where Jack saw the followers disappear at.", 0);
			add_dialog_str(2, "You cautiously step through the wall, not knowing what's on the other side.", 0);
			add_dialog_choice(0, "Ok");
			choice = run_dialog(FALSE);
		}
	}
	else {
		block_entry(TRUE);
		if (get_flag(9, 6) == FALSE) {
			set_flag(9, 6, TRUE);
			message_dialog("The wall feels a little funny here, almost sticky in a way.",
				"You draw your hand back afraid you might be poisoned by it.");
		}
	}
break;

beginstate 19;
	if (get_flag(9, 7) == FALSE) {
		set_flag(9, 7, TRUE);
		message_dialog("There is something funny about the wall here.",
			"You just can't quite put your finger on what it is.");
	}
break;
